package net.wofly.common.condition;

import lombok.Data;

import java.util.List;

/**
 * 条件表达式
 * 表达式加括号后再与其它表达式进行运算
 * 2014-10-28 上午10:22:20
 *
 * @version V1.0
 */
@Data
public class FilterCondition {

	/**
	 * 要过滤的属性名称
	 */
	private String attrName;
	/**
	 * 条件关系符
	 * 当有多个FilterCondition时，标识它们之间的关系。
	 */
	private String conditionRelate;
	/**
	 * 条件结束值
	 * 对于区间值，记录区间的结束值
	 */
	private String endVal;
	/**
	 * 操作符
	 * 当为一元操作符时，操作值在val中；
	 * 当为二元操作符时，操作值分别在startVal及endVal值中
	 */
	private String operation;
	/**
	 * 顺序号
	 * 表示条件的先后顺序。数字越小越靠前
	 */
	private Integer sortNo;
	/**
	 * 条件开始值
	 * 对于区间值，记录区间的开始值
	 */
	private String startVal;
	/**
	 * 条件值
	 * 对于一元操作符，记录单一条件值。
	 */
	private String val;
	/**
	 * 分组序号
	 */
	private Integer group;
	
	
	private String groupRelate;
	
	private List<String> inValueList;
	
	public FilterCondition() {
	}
	
	public FilterCondition(List<String> inValueList,String attrName,String conditionRelate,String operation,Integer sortNo){
		this.inValueList = inValueList;
		this.attrName = attrName;
		this.conditionRelate = conditionRelate;
		this.operation = operation;
		this.sortNo = sortNo;
	}
	
	public FilterCondition(String val,String attrName,String conditionRelate,String operation,Integer sortNo){
		this.val = val;
		this.attrName = attrName;
		this.conditionRelate = conditionRelate;
		this.operation = operation;
		this.sortNo = sortNo;
	}
	public FilterCondition(String val,String attrName,String conditionRelate,String operation,Integer sortNo,Integer group,String groupRelate){
		this.val = val;
		this.attrName = attrName;
		this.conditionRelate = conditionRelate;
		this.operation = operation;
		this.sortNo = sortNo;
		this.group = group;
		this.groupRelate = groupRelate;
	}
	public FilterCondition(String startVal,String endVal,String attrName,String conditionRelate,String operation,Integer sortNo){
		this.startVal = startVal;
		this.endVal = endVal;
		this.attrName = attrName;
		this.conditionRelate = conditionRelate;
		this.operation = operation;
		this.sortNo = sortNo;
	}
	public FilterCondition(String startVal,String endVal,String attrName,String conditionRelate,String operation,Integer sortNo,Integer group,String groupRelate){
		this.startVal = startVal;
		this.endVal = endVal;
		this.attrName = attrName;
		this.conditionRelate = conditionRelate;
		this.operation = operation;
		this.sortNo = sortNo;
		this.group = group;
		this.groupRelate = groupRelate;
	}

}